package com.wh.wisdomsite.xbox.de.service.impl;

import com.baomidou.mybatisplus.mapper.SqlHelper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.wh.wisdomsite.xbox.de.dao.DeviceMapper;
import com.wh.wisdomsite.xbox.de.entity.Device;
import com.wh.wisdomsite.xbox.de.service.IDeviceService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 丁奕
 * @version V1.0
 * @Package com.wh.wisdomsite.xbox.de.service.impl
 * @date 2018年11月23日 17:04
 * @Copyright 企业版权所有
 * @Company 贵州万华科技有限公司Copyright (c) 2018
 */
@Service("deviceService")
@Transactional(rollbackFor = {Exception.class,RuntimeException.class})
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements IDeviceService {
    private static final Log logger = LogFactory.getLog(DeviceServiceImpl.class);

    @Autowired
    private DeviceMapper deviceMapper;

    public Page<Device> getPage(Page<Device> page, Wrapper<Device> wrapper) {
        SqlHelper.fillWrapper(page, wrapper);
        page.setRecords(this.baseMapper.getPage(page, wrapper));
        return page;
    }

    @Override
    public List<Device> getList(Wrapper<Device> wrapper) {
        return deviceMapper.getList(wrapper);
    }

    @Override
    public List<Device> getDeviceById(String deviceId) {
        return deviceMapper.getDeviceById(deviceId);
    }
}
